

package javafx179labs.mikhailov.lab4;

/**
 * @author Админ
 */
// зажми курсор на шаре и двигай мышью....
// place your code here
import javafx.stage.*;

import javafx.scene.*;
import javafx.scene.input.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import javafx.scene.transform.*;


class Pond{
    public var length:Number;
    public var width :Number;
    public var depth :Number;
}

class PondNode extends CustomNode{

    public var scale:Number;
    public var pond:Pond;


    public override function create () {
        Group{
            content: [
                Ellipse{
                    radiusX: bind pond.length/2*scale
                    radiusY: bind pond.width/2*scale
                    fill: Color.DARKBLUE
                    stroke: Color.BLACK
                }, Circle{
                    centerX: bind pond.length/2*scale
                    radius: 7
                    fill: Color.DARKBLUE
                    stroke: Color.BLACK
                    onMouseDragged: function( e: MouseEvent ) {
                        pond.length = e.x*2/scale;
                    }
                }, Circle{
                    centerY: bind-pond.width/2*scale
                    radius: 7
                    fill: Color.DARKBLUE
                    stroke: Color.BLACK
                    onMouseDragged: function( e: MouseEvent ) {
                        pond.width=-e.y*2/scale;
                    }
                }

            ]
        }
    }
}

Stage {
    title:"ХЗ что "
    width:500
    height:500
    scene:Scene {
        content:PondNode{
            scale:100
            pond:Pond{
                length:0
                width:0
                depth:5
            }
            transforms: Translate{x:250 y:250}
        }
        fill: Color.RED
    }
    visible: true
}